<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
<link href="/testxu/css/public.css" rel="stylesheet" type="text/css" />
<script src="/testxu/js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="/testxu/js/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
	var validator = $('#editpassword').validate({
		submitHandler: function() {
			$.ajax({
				type:'POST',
				url:'__URL__/savechangepassword',
				data:{
					username: $("#username").val(),
					password: $("#password").val(),
					password2: $("#password2").val(),
				},
				dataType:'JSON',
				cache:false,
				success:function(data){
					if (data=="") {
						$('#message').html("修改成功！");
					} else {
						$('#message').html(data);
					}
				},
			});
		},
		rules: {
			password: {
				required: true,
				minlength: 6,
				maxlength: 16,
			},
			password2: {
				required: true,
				minlength: 6,
				maxlength: 16,
				equalTo: "#password"

			},
		},
		messages: {
			password: {
				required: "请输入密码",
				minlength: jQuery.format("最少{0}位字符"),
				maxlength: jQuery.format("最少{0}位字符"),
			},
			password2: {
				required: "请再次输入密码",
				minlength: jQuery.format("最少{0}位字符"),
				maxlength: jQuery.format("最少{0}位字符"),
				equalTo: "二次密码不一样",
			},
		},
	});
});

</script>
</head>

<body>
<div id="warp">
  <div id="titleBar">管理员密码修改</div>
  <div id="message"></div>
  <form action="" method="post" id="editpassword">
    <table width="100%" border="1" cellspacing="1" cellpadding="0" class="input">
      <tr>
        <td width="10%">用户名</td>
        <td width="90%"><input name="username" type="text" id="username" value="{$username}" readonly="readonly" /></td>
      </tr>
      <tr>
        <td>密码</td>
        <td><input type="text" name="password" id="password" />
          <span class="status"></span></td>
      </tr>
      <tr>
        <td>确认密码</td>
        <td><input type="text" name="password2" id="password2" />
          <span class="status"></span></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><input type="submit" name="button" id="button" value="修改密码" /></td>
      </tr>
    </table>
  </form>
</div>
</body>
</html>
